//
//  TableViewCell.m
//  LBOrder
//
//  Created by lc on 2016/11/19.
//  Copyright © 2016年 lc. All rights reserved.
//

#import "TableViewCell.h"
#import "OrderModel.h"


@interface TableViewCell()

//我的订单完成时间
@property (weak, nonatomic) IBOutlet UILabel *lb_textStatus;

//我的订单完成状态
@property (weak, nonatomic) IBOutlet UILabel *lb_completeTime;

//第一个图
@property (weak, nonatomic) IBOutlet UIImageView *imagev1;
//第二个图
@property (weak, nonatomic) IBOutlet UIImageView *imagev2;
//第三个图
@property (weak, nonatomic) IBOutlet UIImageView *imagev3;
//第四个图
@property (weak, nonatomic) IBOutlet UIImageView *imagev4;
//第五个图
@property (weak, nonatomic) IBOutlet UIImageView *imagev5;
@property (weak, nonatomic) IBOutlet UILabel *lb_googsum;

@property (weak, nonatomic) IBOutlet UILabel *lb_realPrice;

@end

@implementation TableViewCell

//发福利
- (IBAction)getBenefitsBtn:(UIButton *)sender {
}

- (IBAction)goDetailBt:(id)sender {
    //进入详情页
}

-(void)setModel:(OrderModel *)model {
    _model = model;
    
    NSArray *imageView = @[_imagev1,_imagev2,_imagev3,_imagev4];
    
       //获取图片
    
    for (NSInteger i = 0; (i < model.images.count)&&(i < 4); i++) {
        
        [imageView[i] sd_setImageWithURL:[NSURL URLWithString:model.images[i]]];
    }
    
    if (model.images.count > 4) {
        _imagev5.image = [UIImage imageNamed:@"v2_goodmore"];
    }

    //订单完成时间
    self.lb_completeTime.text = model.lastUpdateTime;
    //订单状态
    self.lb_textStatus.text = model.textStatus;
    
    //所购商品件数
    self.lb_googsum.text = [NSString stringWithFormat:@"共%@件商品",model.goods_nums];
    
    
    //实际商品价格
    self.lb_realPrice.text = [NSString stringWithFormat:@"$%.2lf", model.real_price.doubleValue];

}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
